<extend name="Public/base" />
<block name="content">
<div id="content">
	<div id="content-header">
		<div id="breadcrumb">
			<a class="tip-bottom" href="{:U('Index/index')}" data-original-title="首页"><i class="icon-home"></i> 首页</a>
			<a class="tip-bottom" href="{:U('activitySet?activity_id='.I('activity_id'))}" data-original-title="">{$meta_title_c}</a> 
			<a class="current" href="{$post_url}">{$meta_title}</a>
		</div>
	</div>
    <div class="container-fluid">
    <br/>
    <br/>
        <form method="post">
            <div class="clearfix">
                <span style="font-size:16px;margin-right:15px;">短信模板 </span>
                <a class="btn-link btn-checkbox-all"> 全选 </a>
                |
                <a class="btn-link btn-checkbox-opposite"> 反选</a>
                <notempty name="_list">
                <div class="checkbox-group" style="margin:15px;">
                	<volist name="_list" id="vo">
                    <label class="checkbox inline">
                        <input name="mb_tpl[]" type="checkbox"  value="{$vo.sms_template_id}"> {$vo.sms_template_name}
                    </label>
                    </volist>
                </div>
                <else/>
					<center>暂无可选短信模板</center>
				</notempty>
            </div>
            <input type="hidden" name="activity_id" id="activity_id" value="{$activity_id}"/>
            <button type="submit" class="btn btn-primary">提交</button>
        </form>
    </div>
</div>
<script src="__STATIC__/aui-artDialog-9fd667e/dist/dialog.js"></script>
<link rel="stylesheet" href="__STATIC__/aui-artDialog-9fd667e/css/ui-dialog.css">
<script type="text/javascript">
var IS_INIT = 1;
$(document).ready(function(){
    // 全选
    $(".btn-checkbox-all").click(function() {
        $(this).nextAll("div.checkbox-group").children("label").children("input").prop("checked", true);
    });
    // 反选
    $(".btn-checkbox-opposite").click(function() {
        $(this).nextAll("div.checkbox-group").children("label").children("input[type=checkbox]").each(function() {
            if ($(this).is(":checked")) {
                $(this).prop("checked", false);
            } else {
                $(this).prop("checked", true);
            }
        });
    });	
	
	//初始化登录用户名输入焦点
	tke_form_focus();
	$("form").submit(function(){
		//锁定登录按钮
		$('button').attr('disabled',true);
		var self = $(this);
		$.post("{$post_url}", self.serialize(), call_back, "json");
		return false;
		
		/**
		 * @todo 接收登录返回值
		 * @author PHP@妖孽 <dino_ma@163.com>
		 */
		function call_back(data){
			if(data.status==1){
				tke_alert(data.info,'alert-success');
				setTimeout(function(){
				  if (data.url) {
						location.href=data.url;
					}else{
						location.reload();
					}
				},1500);
			} else {
				$('button').attr('disabled',false);
				tke_alert(data.info,'alert-error');
			}
		}
	});
	//导航高亮
	highlight_subnav("{:U('ServiceManage/index')}");
});
</script>
</block>